from pylab import *
import scipy.ndimage
from fast12 import detect
import sys

import simplejson

if __name__ == '__main__':


    ion()


    if len(sys.argv) < 2:
        print sys.argv[0], '<job_file.json>'
        raise Exception('Insufficient number of parameters')

    finput = open(sys.argv[1])
    job_params = simplejson.load(finput)
    finput.close()

    fileroot = job_params['root_directory']

    for framenum in range(0, 4,2):
        figure(framenum)

        filename = fileroot+'/frames/'+job_params['filename_format']%framenum
        ftfile = fileroot+'/fastcorners/'+job_params['filename_format']%framenum

        img_color = imread(filename)
        features = loadtxt(ftfile)

        pp = array(features)
        imshow(.1+.9*img_color)
        #ylim(100,0)
        plot(pp[:,0], pp[:,1], 'r+', mew=1)
        axis('equal')
        ylim(750,0)
        xlim(0,1000)




